import { comment } from '@/api/comment';
import * as types from '../mutation-types';

// initial state
const state = {
  comment: null,
};

// getters
const getters = {
  getComment: state => state.comment,
};

// actions
const actions = {
  comment(context, params) {
    comment(params)
    .then(data => context.commit(types.COMMENT, data));
  },
};

// mutations
const mutations = {
  [types.COMMENT](state, { data }) {
    // eslint-disable-next-line
    state.comment = data;
  },
};


export default {
  state,
  getters,
  actions,
  mutations,
};
